import { createApp } from 'vue'
// import './style.css'
import App from './App.vue'
import "amfe-flexible"

import { Field, CellGroup,Button,Tabbar, TabbarItem,NavBar,Grid,GridItem } from 'vant';
import vant from 'vant';
// 引入组件样式
import 'vant/lib/index.css';
//引入路由
import router from './router/index'
import Tarbar from './layout/tarbar/tarbar.vue';
//引入状态管理
import { createPinia } from 'pinia'
//token的管理
import { useAuthStore } from '@/stores/auth';
// 用户认证拦截器
import { setupInterceptors } from '@/api/interceptors';
import '@/styles/theme.scss'


const app = createApp(App);
const pinia = createPinia();
app.use(router);
// app.use(Field);
// app.use(CellGroup);
// app.use(Button);
// app.use(Tabbar);
// app.use(TabbarItem);
// app.use(NavBar);
// app.use(Grid);
// app.use(GridItem);
app.use(vant);
app.use(pinia);

// 设置拦截器并传递路由器实例
setupInterceptors(router);

// 在应用启动时清理无效的 token
const authStore = useAuthStore();
if (!authStore.token || authStore.token === 'undefined') {
  authStore.clearToken();
}


app.mount('#app');
